<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>边距重叠情况二</title>
  <style>
    * {
      margin: auto
    }

    #main {
      background: red;
    }

    #main>p {
      background: blue;
      margin: 10px auto 20px;
    }
  </style>
</head>

<body>
  <div id="main">
    <!-- 兄弟元素之间：之间有的上下边距，取最大的值 -->
    <p>1</p>
    <p>2</p>
    <div style="overflow: hidden;">
      <p>3</p>
    </div>
    <p>4</p>
</body>

</html>